package demo;

import java.awt.Button;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
public class JSplitPaneDemo2 {
	public static void main(String args[]) {
		JFrame frame = new JFrame("主窗体");
		Container c = frame.getContentPane();
		frame.setBounds(100, 100, 300, 400);
		JPanel jp1 = new JPanel();
		jp1.setLayout(new FlowLayout(FlowLayout.CENTER));
		jp1.add(new JLabel("标签1"));
		jp1.add(new JLabel("标签2"));
		jp1.add(new JLabel("标签3"));
		jp1.add(new JLabel("标签4"));
		jp1.add(new JLabel("标签5"));
		JPanel jp2 = new JPanel(new GridLayout(3,3,3,3));
		for (int i = 0; i < 9; i++) {
			JButton but = new JButton("按钮"+i);
			
			jp2.add(but);
			
		}
		JSplitPane jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jp1, jp2);
		jsp.setDividerSize(10);
		jsp.setDividerLocation(100);
		c.add(jsp);
		frame.setVisible(true) ;
	}
}

